package main

import (
	"context"
	"log"

	pb "gitee.com/hlwqds/go-project/tag-service/proto"
	"google.golang.org/grpc"
)

func GetClientConn(ctx context.Context, target string, opts []grpc.DialOption) (*grpc.ClientConn, error) {
	opts = append(opts, grpc.WithInsecure())
	return grpc.DialContext(ctx, target, opts...)
}

func main() {
	ctx := context.Background()
	clientConn, _ := GetClientConn(ctx, "localhost:8001", nil)
	defer clientConn.Close()
	tagServiceClient := pb.NewTagServiceClient(clientConn)
	resp, _ := tagServiceClient.GetTagList(
		ctx,
		&pb.GetTagListRequest{
			Name: "Go",
		},
	)
	log.Println(resp)
}
